<?php
namespace app\home\model;
use think\Model;
use think\Db;
use think\Session;
class Quehuo extends Model{
	public function index(){
		// echo 4545;die;
		$res = Db::query("select * from quehuo");
        return $res;
	}
	public function del($id){
		$res=Db::table("quehuo")->where("id='$id'")->delete();
		return $res;
	}
	public function bao(){
		$info=Db::table("huiredbao")->select();
		return $info;
	}
	public function adds($qwe)
	{
		$data = ['hui_name'=>$qwe[0]['red_name'],'hui_price'=>$qwe[0]['red_price'],'hui_order'=>$qwe[0]['red_order'],'hui_time'=>$qwe[0]['time'],'hui_zhuang'=>$qwe[0]['zhuang'],'red_id'=>$qwe[0]['red_id']];
		$sel = Db::table('huiredbao')->where('red_id',$qwe[0]['red_id'])->select();
		if (!$sel) {
			$res=Db::table('huiredbao')->insert($data);
			return $res;
		}
	}
	public function modelpinglun()
	{
		$user_info = session::get("user_info");
        $user_id = $user_info['user_id'];
		$res=Db::query("select * from user_pinglun where uid='$user_id' ");
		return $res;
	}
	public function pinglun_del($id)
	{
		$user_info = session::get("user_info");
        $user_id = $user_info['user_id'];
		$res=Db::table("user_pinglun")->where(['id'=>$id,'uid'=>$user_id])->delete();
		return $res;
	}
	public function red_del($id)
	{
		$res=Db::table("huiredbao")->where("hui_id='$id'")->delete();
		return $res;
	}
}





 ?>